package main

import "fmt"

//接口包含两部分: 动态类型、动态值
//接口实现

type animal interface{
	move()
	eat(string)
}

type cat struct{
	name string
	feet int
}
func (c cat)move(){
	fmt.Println("猫动")
}
func (c cat)eat(foot string){
	fmt.Printf("猫吃%s",foot)
}
type chicken struct{
	name string
	feet int
}
func (c chicken)move(){
	fmt.Println("鸡冻")
}
func (c chicken)eat(food string){
	fmt.Printf("鸡吃%s",food)
}
func main(){
	var a1 animal
	bc:=cat{ //定义一个cat类型变量 bc
		name: "胖菊",
		feet: 4,
	}
	a1=bc
	a1.eat("猫粮")
	fmt.Println(a1)
	var b1 animal
	bd:=chicken{
		name: "及你太美",
		feet: 2,
	}
	b1=bd
	b1.eat("鸡饲料")
	fmt.Println(b1)
}